const state = {
  clusterName: localStorage.getItem('clusterName') || ''
}

const mutations = {
  SET_CLUSTER_NAME(state, name) {
    state.clusterName = name
    localStorage.setItem('clusterName', name)
  }
}

const actions = {
  updateClusterName({ commit }, name) {
    commit('SET_CLUSTER_NAME', name)
  }
}

const getters = {
  clusterName: state => state.clusterName
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
